]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Generalize code to hide subtitle
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 6 Mar 2023 19:29:46 +0000 (16:29 -0300)
committerMarge Bot <marge-bot@gnome.org>
Tue, 21 Mar 2023 20:52:31 +0000 (20:52 +0000)
Commit 9d75d777c72e introduced code to hide the subtitle of the
quick setting toggle when it matches the title of the toggle.
That's because NetworkManager tries to make the network names
more palatable on its own, and reports that the name of single
wired networks is "Wired" even if it may have another name.

What that commit failed to account for, however, is that there are
other circumstances where we end up with a subtitle is exactly the
same of the title. For example, when turning off Wi-Fi or mobile
broadband connections.

The behaviour of commit 9d75d777c72e is safe enough to be applied
on other device-backed connections, so do it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2682>

js/ui/status/network.js

index 61348883cb9f52b0020760606828ca572c5fe328..c9c86a916fc0e0aecb132a49cb5f07f12e025cad 100644 (file)
@@ -1611,6 +1611,13 @@ class NMDeviceToggle extends NMToggle {
         return name;
     }
 
+    _transformSubtitle(source) {
+        const subtitle = super._transformSubtitle(source);
+        if (subtitle === this.title)
+            return null;
+        return subtitle;
+    }
+
     _loadInitialItems() {
         const devices = this._client.get_devices();
         for (const  dev of devices)
@@ -1842,13 +1849,6 @@ class NMWiredToggle extends NMDeviceToggle {
             'gnome-network-panel.desktop');
     }
 
-    _transformSubtitle(source) {
-        const subtitle = super._transformSubtitle(source);
-        if (subtitle === this.title)
-            return null;
-        return subtitle;
-    }
-
     _createDeviceMenuItem(device) {
         return new NMWiredDeviceItem(this._client, device);
     }